package org.dtrd.modules.record.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dtrd.common.util.DateUtils;
import org.dtrd.modules.record.entity.po.DtrdEntRdSigninFoodRecord;

@ApiModel("饮食记录对象")
@Data
public class DietListInfo {


	@ApiModelProperty(value = "记录类型: 1-早餐,2-午餐,3-晚餐,4-早餐加餐,5-午餐加餐,6-晚餐加餐",example = "1 (表示早餐)", required = true)
	private Integer foodRecordType;

	@ApiModelProperty(value = "记录日期 yyyy-MM-dd HH:mm:ss", example = "2021-10-15 22:19:57", required = true)
	private String recordTime;

	@ApiModelProperty(value = "饮食记录图片, 上传图片的链接", required = true)
	private String recordPhoto;

	@ApiModelProperty(value = "备注, 建议添加到备注里")
	private String foodRecordRemark;

	public DietListInfo parseFromPo(DtrdEntRdSigninFoodRecord foodRecord){
		this.setFoodRecordType(foodRecord.getFoodRecordType());
		if (foodRecord.getRecordTime() != null) {
			this.setRecordTime(DateUtils.formatDate(foodRecord.getRecordTime(), DateUtils.datetimeFormat.get().toPattern()));
		}
		this.setRecordPhoto(foodRecord.getRecordPhoto());
		this.setFoodRecordRemark(foodRecord.getFoodRecordRemark());
		return this;
	}
}
